<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let arr = [8,10,12,40];
        // 数组解构  将数组中元素快速的赋值给变量
        // 会按照数组的顺序  逐个进行赋值
        // let a = arr[0]  let b = arr[1]
        // let [a,b,c,d] = arr;
        // console.log(a,b,c,d)

        // 解构指定的序号的数据
        // let [a,,c] = arr
        // console.log(a,c);
        // 多维数组解构
        let arr2 = [1,2,3,[4,5,6]];

        let [a,,,[,b]] = arr2;
        console.log(a,b)

        let n = 10;

        let m = 20;
        // 将m 与n组合为数组 然后解构赋值给nm变量 刚好实现变量数据交互
        [n,m] = [m,n];
        console.log(n)
    </script>
</body>
</html>